﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;

namespace Romeo.Data
{
    public class Move
    {
        public const int MaxFlips = 24;
        internal sbyte _Player;
        internal byte _Cell;
        internal byte[] _Flips = new byte[MaxFlips];
        internal int _FlipCount;

#if DEBUG
        internal int _CacheStatus = 0;
        internal int _PreImage = -1;
        internal int _PostImage = -1;
#endif


        internal void Reset (int aCell, sbyte aPlayer)
        {
            #if DEBUG
                Debug.Assert (_CacheStatus == 0);
                _PreImage = -1;
                _PostImage = -1;
            #endif
            _Player = aPlayer;
            _FlipCount = 0;
            _Cell = (byte)aCell;
        }

        internal bool HasFlip (int aCell)
        {
            for (int i = 0; i < _FlipCount; i++)
            {
                if (_Flips[i] == aCell)
                {
                    return true;
                }
            }
            return false;
        }
    }
}
